package com.example.tests;

import java.util.concurrent.TimeUnit;

import org.junit.Before;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.PageFactory;

import com.example.pages.InternalPage;
import com.example.pages.LoginPage;
import com.example.pages.ManagementPage;
import com.example.pages.MyPageFactory;

import ru.esteru.selenium.factory.WebDriverFactory;

public class BaseTest {
	
	protected WebDriver driver;
	protected String baseUrl;
	protected LoginPage loginPage;
	protected InternalPage somePage;
	protected ManagementPage managementPage;
	
	@Before
	public void setUp() throws Exception {
		driver = WebDriverFactory.getDriver(DesiredCapabilities.firefox());
		baseUrl = "http://localhost/";
		driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
	}

	public LoginPage goToMainPage() {
		driver.get(baseUrl + "/php4dvd/");
		loginPage = PageFactory.initElements(driver, LoginPage.class);
		somePage = PageFactory.initElements(driver, InternalPage.class);
		managementPage = PageFactory.initElements(driver, ManagementPage.class);
		return MyPageFactory.getPage(driver, LoginPage.class);
	}
}
